<?php
// https://github.com/videlalvaro/php-amqplib
require_once __DIR__.'/vendor/autoload.php';
use PhpAmqpLib\Connection\AMQPStreamConnection;
use PhpAmqpLib\Message\AMQPMessage;

$connect = new AMQPStreamConnection('192.168.205.128', 5672, 'admin', '123456');
$channel = $connect->channel();

$channel->exchange_declare('tell_direct', 'direct', false, false, false);
$level = $argv[1] ? : 'info';

$data = implode(' ', array_slice($argv, 2));

$msg = new AMQPMessage($data);

$channel->basic_publish($msg, 'tell_direct', $level);

echo "[x] Send ~$level : $data".PHP_EOL;

$channel->close();
$connect->close();
